74a62c
@@ -17,6 +17,7 @@
 package org.apache.camel.dataformat.zipfile;
 
 import java.io.BufferedInputStream;
+import java.io.Closeable;
 import java.io.IOException;
 import java.io.InputStream;
 import java.util.Iterator;
@@ -35,7 +36,7 @@
import org.slf4j.LoggerFactory;
  * The Iterator which can go through the ZipInputStream according to ZipEntry
  * Based on the thread <a href="http://camel.465427.n5.nabble.com/zip-file-best-practices-td5713437.html">zip file best practices</a>
  */
-class ZipIterator implements Iterator<Message> {
+public class ZipIterator implements Iterator<Message>, Closeable {
     static final Logger LOGGER = LoggerFactory.getLogger(ZipIterator.class);
     
     private final Message inputMessage;
@@ -124,7 +125,7 @@
class ZipIterator implements Iterator<Message> {
     }
 
     private ZipEntry getNextEntry() throws IOException {
-        ZipEntry entry = null;
+        ZipEntry entry;
 
         while ((entry = zipInputStream.getNextEntry()) != null) {
             if (!entry.isDirectory()) {
@@ -139,4 +140,11 @@
class ZipIterator implements Iterator<Message> {
     public void remove() {
         throw new UnsupportedOperationException();
     }
+
+    @Override
+    public void close() throws IOException {
+        if (zipInputStream != null) {
+            zipInputStream.close();
+        }
+    }
 }
\ No newline at end of file
